<?php
//Get MySQL database output via PHP to XML
header("Content-Type: text/xml"); //set the content type to xml
// Initialize the xmlOutput variable
$xmlBody = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$xmlBody .= "<XML>";

        mysql_connect("localhost","root","");
        mysql_select_db("gs3_demo");
        
        $get = mysql_query("SELECT * FROM tupperware_demo");
        while($row = mysql_fetch_array($get))
        {
            $id = $row["Default"]; 
            $title = $row["ProductMarket"];   
            $description = $row["Segment"];
            
            // Start filling the $xmlBody variable with looping content here inside the while loop 
            // It will loop through 20 items from the database and render into XML format
            $xmlBody .= '
                <Data> 
                    <DataID>' . $id . '</DataID> 
                    <DataTitle>' . $title . '</DataTitle>
                    <DataDate>' . $title . '</DataDate>
                    <DataDescr>' . $description . '</DataDescr>
                </Data>';
        } // End while loop
        mysql_close(); // close the mysql database connection
$xmlBody .= "</XML>";


echo $xmlBody; // output the gallery data as XML file for flash
?>
